Skip to content

fix: add usage tracking to config method #151

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jsonbailey
Copy link
Contributor

@jsonbailey jsonbailey commented Aug 14, 2025

Tracking internally in SDK-1414.

Add usage tracking to config method

This PR implements SDK spec requirement 1.2.3.5 by adding usage tracking to the config method across all AI SDK repositories, following the pattern established in JS Core PR #904.

Requirements

  • I have added test coverage for new or changed functionality
  • I have followed the repository's pull request submission guidelines
  • I have validated my changes against all supported platform versions ⚠️ See testing notes below

Related issues

Describe the solution you've provided

Added a single tracking call track('$ld:ai:config:function:single', context, key, 1) at the beginning of each config method across all 4 AI SDK repositories:

  • Ruby: @ld_client.track('$ld:ai:config:function:single', context, config_key, 1)
  • Python: self._client.track('$ld:ai:config:function:single', context, key, 1)
  • Go: c.sdk.TrackMetric("$ld:ai:config:function:single", context, 1, ldvalue.String(key))
  • .NET: _client.Track("$ld:ai:config:function:single", context, LdValue.Of(key), 1)

Each implementation includes a corresponding unit test to verify the tracking call is made with the correct parameters.

Critical Review Points

⚠️ Testing Limitations: Due to local environment setup constraints, I was unable to run the full test suites locally. The tests were written based on existing patterns but should be verified to pass in the proper CI environment.

🔍 Key Items to Review:

  1. Tracking method signatures: Each SDK uses different tracking APIs - verify parameter order and types are correct
  2. Event consistency: Confirm the event name $ld:ai:config:function:single is exactly as specified
  3. Method placement: Tracking call is added at the beginning of each config method - verify this is the intended location
  4. Test validity: Run tests to ensure they pass and properly verify the tracking functionality

Describe alternatives you've considered

  • Considered placing tracking calls after input validation, but chose to place them at method entry to ensure all invocations are tracked
  • Each SDK's tracking implementation follows its existing patterns rather than trying to standardize the approach

Additional context

Cross-SDK Implementation Details

SDK Tracking Method Parameter Order
Ruby track(event, context, key, value) Standard LaunchDarkly pattern
Python track(event, context, key, value) Standard LaunchDarkly pattern
Go TrackMetric(event, context, value, data) Go-specific metric tracking
.NET Track(event, context, data, value) .NET-specific parameter order

Human Review Checklist

Please verify the following during review:

  • Parameter ordering: Confirm tracking method parameters are in correct order for each SDK
  • Event name accuracy: Verify $ld:ai:config:function:single matches SDK spec requirement exactly
  • Test execution: Run test suites to ensure all new tests pass (especially given CI environment differences)
  • Integration testing: Verify tracking doesn't interfere with existing config method functionality
  • Cross-platform compatibility: Test against all supported platform versions for each SDK
  • Mock accuracy: Ensure test mocks accurately represent real SDK tracking behavior

- Add tracking call for :ai:config:function:single event
- Include test to verify tracking functionality
- Follows SDK spec requirement 1.2.3.5

Co-Authored-By: [email protected] <[email protected]>
@jsonbailey jsonbailey requested a review from a team as a code owner August 14, 2025 15:00
Copy link

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@devin-ai-integration devin-ai-integration bot changed the title feat: add usage tracking to config method fix: add usage tracking to config method Aug 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant